﻿using System.Reflection;

namespace Borg.AddOn
{
    internal sealed class MethodInvokerNotificationHookChain : IMethodInvokerNotificationHook
    {
        private readonly IMethodInvokerNotificationHook[] _hooks;

        public MethodInvokerNotificationHookChain(IMethodInvokerNotificationHook[] hooks)
        {
            _hooks = hooks;
        }

        public void OnInvocationFinished(Extension extension, MethodInfo method)
        {
            foreach (IMethodInvokerNotificationHook hook in _hooks)
                hook.OnInvocationFinished(extension, method);
        }

        public void OnInvocationStarted(Extension extension, MethodInfo method)
        {
            foreach (IMethodInvokerNotificationHook hook in _hooks)
                hook.OnInvocationStarted(extension, method);
        }
    }
}
